package com.dy.cloud.config;

import org.springframework.cloud.gateway.route.RouteLocator;
import org.springframework.cloud.gateway.route.builder.RouteLocatorBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @ClassName:
 * @Author: 仄言in
 * @Desctiption: (描述)
 * @Date: 2021/9/22 16:41
 * @Version 1.0 (版本)
 */
@Configuration
public class CloudGatewayConfig {
    @Bean
    public RouteLocator getRouterLocator(RouteLocatorBuilder builder){
        RouteLocatorBuilder.Builder routes = builder.routes();
        routes.route("path_route_dy",r -> r.path("/dy").uri("https://www.bilibili.com")).build();
        routes.route("path_route_dy2",r -> r.path("/dy1").uri("https://gitee.com/dyinin")).build();
        return routes.build();
    }
}
